﻿// =================================================================== 
// 项目说明
//====================================================================
// Sushee。@Copy Right 2019
// 文件： GovUserCitiesRel.cs
// 项目名称：斑马车务
// 创建时间：2019/1/16
// 负责人：Sushee
// ===================================================================
using System.Collections.Generic;
using CGT.Infrastructure.Entity;
using CGT.Infrastructure.Repository;
namespace CGT.Infrastructure.Service
{

    /// <summary>
    ///
    /// </summary>
    public class GovUserCitiesRelService
    {
        protected GovUserCitiesRelRepository repository;

        public GovUserCitiesRelService()
        {
            repository = new GovUserCitiesRelRepository();
        }

        #region 增删改查

        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public object Insert(GovUserCitiesRel entity) { return repository.Insert(entity); }

        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public object Insert(List<GovUserCitiesRel> entitys) { return repository.Insert(entitys); }

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public bool Update(GovUserCitiesRel entity) { return repository.Update(entity); }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public bool Delete(GovUserCitiesRel entity) { return repository.Delete(entity); }

        /// <summary>
        /// 删除所有
        /// </summary>
        /// <returns></returns>
        public bool DeleteAll() { return repository.DeleteAll(); }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public bool Delete(int primaryKey) { return repository.Delete(primaryKey); }

        /// <summary>
        /// 查询单个实体
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public GovUserCitiesRel SingleOrDefault(object primaryKey) { return repository.SingleOrDefault(primaryKey); }


        /// <summary>
        /// 查询单个实体,如果存在多条则引发异常
        /// </summary>
        /// <param name="primaryKey">主键</param>
        /// <returns></returns>
        public GovUserCitiesRel Single(object primaryKey) { return repository.Single(primaryKey); }

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        public List<GovUserCitiesRel> QueryAll()
        {
            return repository.QueryAll();
        }
        /// <summary>
        /// 根据用户Id获取配置城市信息
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public List<GovUserCitiesRel> GetByUserId(int userId)
        {
            return repository.GetByUserId(userId);
        }

        public void BatchDelete(int userId)
        {
            repository.BatchDeleteByUserId(userId);
        }
        #endregion
    }

}